<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <link rel="stylesheet" href="__STATIC__/web/index/sweepcode/css/login.css">
        <script src="__STATIC__/web/index/sweepcode/js/public.js"></script>
        <title>注册克克美</title>
        <style type="text/css">

            .weixin-tip img{max-width: 100%; height: auto;}
            .weixin-tip{display: none; position: fixed; left:0; top:0; bottom:0; background: rgba(0,0,0,0.8); filter:alpha(opacity=80);  height: 100%; width: 100%; z-index: 100;}
            .weixin-tip p{text-align: center; margin-top: 10%; padding:0 5%;}
        </style>
    </head>
    <body>
        <!--log-->
        <div id="log">
            <img src="__STATIC__/web/index/sweepcode/img/logo@2x.png" alt="" id="img">
        </div>
        <!--centen-->
        <div>
            <div id="ipt">
                <input type="number"  id="phone" name="phone" placeholder=" 请输入手机号">
                <div class="Br"></div>

                <input type="number" id="code" name="code" placeholder=" 请输入验证号码" class="ipt_cen">
                <div class="Br"></div>

                <input type="password" id="pwd" name="pwd" placeholder=" 请输入密码,记住密码" class="ipt_cen">
                <div class="Br br"></div>

                <button class="btn" onClick="addSchool()">注册</button>
                <button class="code_btn" id="vcode" onClick="sendcode()">获取验证码</button>
                <div class="foot">用户注册即代表您已阅读并同意克克美 
                    <span><a href="http://app.dwkkm.com/kkmtest/public/index/index/protocol">《服务协议》</a></span>
                </div>
            </div>
            <!--最后-->
            
        </div>
        <div class="weixin-tip">
            <p>
                <img src="__STATIC__/web/H5/item/img/android_weixin.png" alt="微信打开" id="imgId" style=" width: 100%"/>
            </p>
        </div>
        <script type="text/javascript" src="__STATIC__/web/index/sweepcode/js/jquery-1.8.1.min.js"></script>
        <script>
                    window.onload = function () {
                        var ua = navigator.userAgent.toLowerCase();
                        var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
                        var winHeight = $(window).height();
                        if ((navigator.userAgent.match(/(iPhone|iPod|ios|iOS|iPad|Backerry|WebOS|Symbian|Windows Phone|Phone)/i))) {
                            if (userAgent.indexOf("Safari") <= -1) {
                                $("#imgId").attr('src', "__STATIC__/web/H5/item/img/iphone_weixin.png");
                                $(".weixin-tip").css("height", winHeight);
                                $(".weixin-tip").show();
                                die;
                            }
                        } else {
                            if (ua.match(/MicroMessenger/i) == "micromessenger") {
                                $("#imgId").attr('src', "__STATIC__/web/H5/item/img/android_weixin.png");
                                $(".weixin-tip").css("height", winHeight);
                                $(".weixin-tip").show();
                                die;
                            }
                        }
                    };
                    //注册
                    function addSchool() {
                        var phone = document.getElementById("phone").value;
                        var code = document.getElementById("code").value;
                        var pwd = document.getElementById("pwd").value;
                        var id = "{$id}";
                        var share_id = "{$share_id}";
                        //var isno = $(".protocol").children("img").attr("src");
                        //alert(isno);
                        $.post(
                                "{:url('index/index/register','','')}",
                                {custom_phone: phone, code: code, custom_pwd: pwd, store_id: id, share_id: share_id},
                                function (data) {
                                    //alert(data.code);
                                    if (data.code == 10009) {
                                        alert(data.msg);
                                        //window.location.href = "http://a.app.qq.com/o/simple.jsp?pkgname=com.XinSmartSky.kekemei"; /***打开app的下载***/
                                        var ua = navigator.userAgent.toLowerCase();
                                        var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
                                        var winHeight = $(window).height();
                                        var store_id = "{$id}";
                                        var ctm_phone = data.data;
                                        if ((navigator.userAgent.match(/(iPhone|iPod|ios|iOS|iPad|Backerry|WebOS|Symbian|Windows Phone|Phone)/i))) {
                                            if (userAgent.indexOf("Safari") <= -1) {
                                                $("#imgId").attr('src', "__STATIC__/web/H5/item/img/iphone_weixin.png");
                                                $(".weixin-tip").css("height", winHeight);
                                                $(".weixin-tip").show();
                                                die;
                                            }
                                            location.href = 'kkmapp://storeoa.app/openwith?store_id=' + store_id + '&ctm_phone=' + ctm_phone;
                                            window.setTimeout(function () {
                                                location.href = "https://itunes.apple.com/cn/app/ke-ke-mei/id1050527415?mt=8";
                                            }, 30)
                                        } else {
                                            if (ua.match(/MicroMessenger/i) == "micromessenger") {
                                                $("#imgId").attr('src', "__STATIC__/web/H5/item/img/android_weixin.png");
                                                $(".weixin-tip").css("height", winHeight);
                                                $(".weixin-tip").show();
                                                die;
                                            }
                                            location.href = 'kkmapp://storeoa.app/openwith?store_id=' + store_id + '&ctm_phone=' + ctm_phone;
                                            window.setTimeout(function () {
                                                location.href = "http://android.myapp.com/myapp/detail.htm?apkName=com.XinSmartSky.kekemei";
                                            }, 30)
                                        }
                                    } else if (data.code == 0) {
                                        //window.location.href = "http://a.app.qq.com/o/simple.jsp?pkgname=com.XinSmartSky.kekemei"; /***打开app的下载***/
                                        var store_id = "{$id}";
                                        var ctm_phone = data.data;
                                        var ua = navigator.userAgent.toLowerCase();
                                        var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
                                        var winHeight = $(window).height();
                                        if ((navigator.userAgent.match(/(iPhone|iPod|ios|iOS|iPad|Backerry|WebOS|Symbian|Windows Phone|Phone)/i))) {
                                            if (userAgent.indexOf("Safari") <= -1) {
                                                $("#imgId").attr('src', "__STATIC__/web/H5/item/img/iphone_weixin.png");
                                                $(".weixin-tip").css("height", winHeight);
                                                $(".weixin-tip").show();
                                                die;
                                            }
                                            location.href = 'kkmapp://storeoa.app/openwith?store_id=' + store_id + '&ctm_phone=' + ctm_phone;
                                            window.setTimeout(function () {
                                                location.href = "https://itunes.apple.com/cn/app/ke-ke-mei/id1050527415?mt=8";
                                            }, 30)
                                        } else {
                                            if (ua.match(/MicroMessenger/i) == "micromessenger") {
                                                $("#imgId").attr('src', "__STATIC__/web/H5/item/img/android_weixin.png");
                                                $(".weixin-tip").css("height", winHeight);
                                                $(".weixin-tip").show();
                                                die;
                                            }
                                            location.href = 'kkmapp://storeoa.app/openwith?store_id=' + store_id + '&ctm_phone=' + ctm_phone;
                                            window.setTimeout(function () {
                                                location.href = "http://android.myapp.com/myapp/detail.htm?apkName=com.XinSmartSky.kekemei";
                                            }, 30)
                                        }
                                    } else {
                                        alert(data.msg);
                                    }
                                });
                        window.alert = function (name) {
                            var iframe = document.createElement("IFRAME");
                            iframe.style.display = "none";
                            iframe.setAttribute("src", 'data:text/plain,');
                            document.documentElement.appendChild(iframe);
                            window.frames[0].window.alert(name);
                            iframe.parentNode.removeChild(iframe);
                        }

                    }
                    //发送验证码
                    function sendcode() {
                        var phone = document.getElementById("phone").value;
                        $.post(
                                "{:url('index/index/sendCode','','')}",
                                {custom_phone: phone},
                                function (data) {
                                    if (data.code == 10009) {
                                        alert(data.msg);
                                        //window.location.href = "http://a.app.qq.com/o/simple.jsp?pkgname=com.XinSmartSky.kekemei"; /***打开app的下载***/
                                        var store_id = "{$id}";
                                        var ctm_phone = data.data;
                                        var ua = navigator.userAgent.toLowerCase();
                                        var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
                                        var winHeight = $(window).height();
                                        if ((navigator.userAgent.match(/(iPhone|iPod|ios|iOS|iPad|Backerry|WebOS|Symbian|Windows Phone|Phone)/i))) {
                                            if (userAgent.indexOf("Safari") <= -1) {
                                                $("#imgId").attr('src', "__STATIC__/web/H5/item/img/iphone_weixin.png");
                                                $(".weixin-tip").css("height", winHeight);
                                                $(".weixin-tip").show();
                                                die;
                                            }
                                            location.href = 'kkmapp://storeoa.app/openwith?store_id=' + store_id + '&ctm_phone=' + ctm_phone;
                                            window.setTimeout(function () {
                                                location.href = "https://itunes.apple.com/cn/app/ke-ke-mei/id1050527415?mt=8";
                                            }, 30)
                                        } else {
                                            if (ua.match(/MicroMessenger/i) == "micromessenger") {
                                                $("#imgId").attr('src', "__STATIC__/web/H5/item/img/android_weixin.png");
                                                $(".weixin-tip").css("height", winHeight);
                                                $(".weixin-tip").show();
                                                die;
                                            }
                                            location.href = 'kkmapp://storeoa.app/openwith?store_id=' + store_id + '&ctm_phone=' + ctm_phone;
                                            window.setTimeout(function () {
                                                location.href = "http://android.myapp.com/myapp/detail.htm?apkName=com.XinSmartSky.kekemei";
                                            }, 30)
                                        }
                                    } else {
                                        alert(data.msg);
                                    }
                                });
                        window.alert = function (name) {
                            var iframe = document.createElement("IFRAME");
                            iframe.style.display = "none";
                            iframe.setAttribute("src", 'data:text/plain,');
                            document.documentElement.appendChild(iframe);
                            window.frames[0].window.alert(name);
                            iframe.parentNode.removeChild(iframe);
                        }
                    }
                    //获取手机唯一标识
                    function see() {
//                var imei = navigator.userAgent;
//                alert(imei);
                        mui.plusReady(function () {
                            alert(JSON.stringify(h.device()));
                            console.log(JSON.stringify(h.device()));
                        });

                    }
        </script>
    </body>
</html>